package com.azxc.rapid.plus.system.mapper;

import com.azxc.rapid.plus.system.vo.TreeNodeVO;
import com.azxc.rapid.system.entity.Dept;
import com.azxc.rapid.system.entity.Region;
import com.azxc.rapid.system.vo.DeptVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * DeptMapper 接口
 */
public interface DeptPlusMapper extends BaseMapper<Dept> {

	/**
	 * 懒加载部门列表
	 *
	 * @param tenantId
	 * @param parentId
	 * @param param
	 * @return
	 */
	List<DeptVO> lazyList(String tenantId, Long parentId, Map<String, Object> param);

	/**
	 * 获取树形节点
	 *
	 * @param tenantId
	 * @return
	 */
	List<DeptVO> tree(String tenantId);

	/**
	 * 懒加载获取树形节点
	 *
	 * @param tenantId
	 * @param parentId
	 * @return
	 */
	List<DeptVO> lazyTree(String tenantId, Long parentId);

	/**
	 * 获取部门名
	 *
	 * @param ids
	 * @return
	 */
	List<String> getDeptNames(Long[] ids);

	Region getListDeptById(@Param("deptId") String deptId);

	List<DeptVO> getListDeptByRegionCodes(@Param("codes") List<String> codes);

	List<TreeNodeVO> getTreeByUser(@Param("deptId") String deptId);

	List<TreeNodeVO> getCurrentDept(@Param("deptId") String deptId);

	List<TreeNodeVO> getLazyTreeByUser(@Param("deptId") String deptId);

	DeptVO getDeptByCode(@Param("regionCode") String regionCode);

	List<TreeNodeVO> ChildDeptByUser(@Param("deptId") String deptId,@Param("deptName") String deptName );

	List<TreeNodeVO> ChildDeptByUserRegionCode(@Param("deptId") String deptId,@Param("regionCode") String regionCode
	,@Param("levelLength") int levelLength);

	List<DeptVO> ChildDeptByDeptId(@Param("deptId") String deptId);

	List<DeptVO> deptByDeptId(@Param("deptId") String deptId);


	Long getDeptByRegionCodeAndType(@Param("regionCode") String regionCode,
									@Param("type") String type);

	List<Dept> selectDeptListByRegion(@Param("regionCode")String regionCode,@Param("deptId") String deptId,@Param("minLength")int minLength,@Param("manxLength")int manxLength);

	List<TreeNodeVO> treeByRegion(@Param("regionCode")String regionCode);
}
